/**
 * Created by Administrator on 2017/1/21.
 */

var MJ = require('../MJ/MJ');

var ScoreRule = clone(MJ.ScoreRule);
ScoreRule.QingYiSe =  201;      // 清一色
ScoreRule.QiZiQuan = 202;       //七字全
ScoreRule.HunYiSe =  203;       // 混一色
ScoreRule.PPHGSH =  204;       // 碰碰胡杠上花
ScoreRule.PPHQYS =  205;       // 碰碰胡清一色
ScoreRule.PPHGSHQYS =  207;       // 碰碰胡杠上花清一色
ScoreRule.PPHHYS =  206;       // 碰碰胡混一色
ScoreRule.PPHGSHHYS =  208;       // 碰碰胡杠上花混一色
ScoreRule.PPH =  209;       // 碰碰胡
ScoreRule.QYSGSH =  210;       // 清一色杠上花
ScoreRule.QYSQG =  211;       // 清一色抢杠
ScoreRule.HYSGSH =  212;       // 混一色杠上花
ScoreRule.HYSQG =  213;       // 混一色抢杠
ScoreRule.QZQQG =  214;       // 七字全抢杠
ScoreRule.ONE13QG =  215;       // 13烂抢杠
ScoreRule.THONE13 =  216;       // 天胡13烂
ScoreRule.THQZQ =  217;       // 天胡七字全
ScoreRule.THHYS =  218;       // 天胡混一色
ScoreRule.THQYS =  219;       // 天胡清一色
ScoreRule.QDQYS =  220;       // 清一色七对
ScoreRule.QDHYS =  221;       // 混一色七对
ScoreRule.DHONE13 =  222;       // 地胡13烂
ScoreRule.DHQZQ =  223;       // 地胡七字全
ScoreRule.DHHYS =  224;       // 地胡混一色
ScoreRule.DHQYS =  225;       // 地胡清一色

var Pattern = {
    'NONE': 0,                       // 不是可胡的牌型
    'NORMAL': MJ.Pattern.NORMAL,  // 平胡1
    'PAIR': 2,
    'PAIR7': MJ.Pattern.PAIR7,    // 七对3
    'BPAIR7': 10,    // 带宝七对
    'PPH': MJ.Pattern.SINGLE,     //碰碰胡4
    'SIBAO': 5,                     //4个宝直接胡牌
    'ONE13': 6,                     // 13不搭
    'QZQ': 7,                        //七字全
    'PPHGSH': 8,                        //碰碰胡杠上花
    'GANGKAI' : 9,                       //杠上花
    'QIANGGANG' : 11,                       //枪杠
    'QZQQG' : 12,                       //七字全枪杠
    'ONE13QG' : 13,                       //十三烂枪杠
    'QINGYISE' : 14,                       //清一色
    'HUNYISE' : 15,                       //混一色
    'TIANHU' : 16,                       //天胡
    'THQZQ' : 17,                       //天胡七字全
    'THONE13' : 18,                       //天胡十三烂
    'DIHU' : 16,                       //天胡
    'DHQZQ' : 17,                       //天胡七字全
    'DHONE13' : 18,                       //天胡十三烂
};

var PatternScore = {};
PatternScore[Pattern.NORMAL] = 4;
PatternScore[Pattern.PAIR7] = 20;
PatternScore[Pattern.BPAIR7] = 8;
PatternScore[Pattern.ONE13] = 8;
PatternScore[Pattern.SIBAO] = 20;
PatternScore[Pattern.PPH] = 0;
PatternScore[Pattern.PAIR] = 4;
PatternScore[Pattern.QZQ] = 16;
PatternScore[Pattern.PPHGSH] = 0;
PatternScore[Pattern.GANGKAI] = 0;
PatternScore[Pattern.QIANGGANG] = 0;
PatternScore[Pattern.QZQQG] = 0;
PatternScore[Pattern.ONE13QG] = 0;
PatternScore[Pattern.QINGYISE] = 16;
PatternScore[Pattern.HUNYISE] = 8;
PatternScore[Pattern.TIANHU] = 0;
PatternScore[Pattern.THQZQ] = 0;
PatternScore[Pattern.THONE13] = 0;
PatternScore[Pattern.DIHU] = 0;
PatternScore[Pattern.DHQZQ] = 0;
PatternScore[Pattern.DHONE13] = 0;

var ItemScore = {};
ItemScore[ScoreRule.DH] = 0;
ItemScore[ScoreRule.ZM] = 0;
ItemScore[ScoreRule.LZ] = 0;
ItemScore[ScoreRule.GSH] = 20;
ItemScore[ScoreRule.GSP] = 0;
ItemScore[ScoreRule.QG] = 20;
ItemScore[ScoreRule.BT] = 0;
ItemScore[ScoreRule.TH] = 20;
ItemScore[ScoreRule.DIHU] = 20;
ItemScore[ScoreRule.TT] = 0;

ItemScore[ScoreRule.HunYiSe] = 8;
ItemScore[ScoreRule.QingYiSe] = 16;
ItemScore[ScoreRule.QiZiQuan] = 16;

ItemScore[ScoreRule.PPHGSH] = 40;
ItemScore[ScoreRule.PPHQYS] = 80;
ItemScore[ScoreRule.PPHHYS] = 40;
ItemScore[ScoreRule.PPHGSHHYS] = 80;
ItemScore[ScoreRule.PPHGSHQYS] = 160;
ItemScore[ScoreRule.PPH] = 20;
ItemScore[ScoreRule.QYSGSH] = 80;
ItemScore[ScoreRule.HYSGSH] = 40;
ItemScore[ScoreRule.QYSQG] = 80;
ItemScore[ScoreRule.HYSQG] = 40;
ItemScore[ScoreRule.QZQQG] = 80;
ItemScore[ScoreRule.ONE13QG] = 40;
ItemScore[ScoreRule.THQZQ] = 80;
ItemScore[ScoreRule.THONE13] = 40;
ItemScore[ScoreRule.THQYS] = 80;
ItemScore[ScoreRule.THHYS] = 40;
ItemScore[ScoreRule.QDQYS] = 80;
ItemScore[ScoreRule.QDHYS] = 40;
ItemScore[ScoreRule.DHQZQ] = 80;
ItemScore[ScoreRule.DHONE13] = 40;
ItemScore[ScoreRule.DHQYS] = 80;
ItemScore[ScoreRule.DHHYS] = 40;

var ScoreReason = {
    DH: MJ.Result.DH,  // 点胡/点炮
    ZM: MJ.Result.ZM,  // 自摸/被自摸
    //PIAO: 301,          // 飘
    //SIBAO:11,
    BT: ScoreRule.BT, // 报听
    LZ: ScoreRule.LZ, // 庄家
    QG: ScoreRule.QG, // 抢杠
};

var GangScore = {};
GangScore[MJ.Gang.BA] = 2;
GangScore[MJ.Gang.AN] = 4;
GangScore[MJ.Gang.DIAN] = 2;
GangScore[MJ.Gang.ANS] = 4;

exports.ScoreRule = ScoreRule;
exports.Pattern = Pattern;
exports.PatternScore = PatternScore;
exports.ItemScore = ItemScore;
exports.ScoreReason = ScoreReason;
exports.GangScore = GangScore;

//exports.SpecGang = SpecGang;
//exports.SpecGangScore = SpecGangScore;